package 第二章;
import java.util.Scanner;
public class 一个4位数的各个数位交换 {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        System.out.print("请输入一个4位正整数：");
        int nmb=input.nextInt();
        int first=nmb%10;
        int second=((nmb-first)/10)%10;
        int third=((nmb-first-second*10)/100)%10;
        int fourth=((nmb-first-second*10-third*100)/1000)%10;
        int first_1=(first+5)%10;
        int second_1=(second+5)%10;
        int third_1=(third+5)%10;
        int fourth_1=(fourth+5)%10;
        System.out.println("加密后的数字为："+(first_1*1000+second_1*100+third_1*10+fourth_1));
    }
}
